//
//  XLHomeInteractor.m
//  industry
//
//  Created by xl on 2020/11/12.
//  Copyright © 2020 Haier. All rights reserved.
//

#import "XLHomeInteractor.h"
#import "XLHomeInteractorProtocol.h"
#import "XLSwitchCompanyVC.h"
#import "XLAllIndexVC.h"
#import "XLEditIndexVC.h"
#import "XLAllApplyVC.h"
#import "XLScanCodeVC.h"
#import "XLHomeViewProtocol.h"
#import "XLHomePresenterProtocol.h"
#import "XLSwitchUserVC.h"

@interface XLHomeInteractor ()<XLHomeInteractorProtocol>

@end
@implementation XLHomeInteractor

- (void)dealloc {
    XLLog(@"XLHomeInteractor dealloc");
}

#pragma mark - XLHomeInteractorProtocol
- (void)gotoSwitchCompanyVC {
    XLSwitchCompanyVC *vc = [[XLSwitchCompanyVC alloc] init];
    [self.baseController.navigationController pushViewController:vc animated:YES];
}

- (void)gotoSwitchUserVC {
    XLSwitchUserVC *vc = [[XLSwitchUserVC alloc] init];
    [self.baseController.navigationController pushViewController:vc animated:YES];
}

- (void)gotoEditIndexVC:(NSArray *)array {
    XLEditIndexVC *vc = [[XLEditIndexVC alloc] init];
    vc.indexArr = array;
    WEAKSELF
    vc.ChangeBlock = ^(NSArray *array) {
        STRONGSELF
        XLSend(strongSelf.baseController.presenter, XLHomePresenterProtocol, requestIndexsOrder:array);
        XLSend(strongSelf.baseController.cView, XLHomeViewProtocol, refreshIndexsData:array);

    };
    [self.baseController.navigationController pushViewController:vc animated:YES];
}

- (void)gotoAllIndexVC:(NSArray *)array {
    XLAllIndexVC *vc = [[XLAllIndexVC alloc] init];
    vc.indexArr = array;
    [self.baseController.navigationController pushViewController:vc animated:YES];
}

- (void)gotoAllApplyVC:(NSArray *)commonArr
                allArr:(NSArray *)allArr {
    XLAllApplyVC *vc = [[XLAllApplyVC alloc] init];
    vc.commonArr = commonArr;
    vc.allArr = allArr;
    WEAKSELF
    vc.block = ^(NSArray * _Nonnull commonArr, NSArray * _Nonnull allArr){
        STRONGSELF
       XLSend(strongSelf.baseController.cView, XLHomeViewProtocol, refreshCommonApplet);
   };
    [self.baseController.navigationController pushViewController:vc animated:YES];
}

- (void)gotoScanCodeVC {
    XLScanCodeVC *vc = [[XLScanCodeVC alloc] init];
    [self.baseController.navigationController pushViewController:vc animated:YES];
}
@end
